3.168 \(\int \frac{1+x+x^2+x^3}{1+x^4} \, dx\)

Optimal. Leaf size=53 \[ \frac{1}{4} \log \left (x^4+1\right )+\frac{1}{2} \tan ^{-1}\left (x^2\right )-\frac{\tan ^{-1}\left (1-\sqrt{2} x\right )}{\sqrt{2}}+\frac{\tan ^{-1}\left (\sqrt{2} x+1\right )}{\sqrt{2}} \]

[Out]

ArcTan[x^2]/2 - ArcTan[1 - Sqrt[2]*x]/Sqrt[2] + ArcTan[1 + Sqrt[2]*x]/Sqrt[2] + Log[1 + x^4]/4

________________________________________________________________________________________

Rubi [A]  time = 0.0418564, antiderivative size = 53, normalized size of antiderivative = 1., number of steps used = 11, number of rules used = 8, integrand size = 17, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.471, Rules used = {1876, 1162, 617, 204, 1248, 635, 203, 260} \[ \frac{1}{4} \log \left (x^4+1\right )+\frac{1}{2} \tan ^{-1}\left (x^2\right )-\frac{\tan ^{-1}\left (1-\sqrt{2} x\right )}{\sqrt{2}}+\frac{\tan ^{-1}\left (\sqrt{2} x+1\right )}{\sqrt{2}} \]

Antiderivative was successfully verified.

[In]

Int[(1 + x + x^2 + x^3)/(1 + x^4),x]

[Out]

ArcTan[x^2]/2 - ArcTan[1 - Sqrt[2]*x]/Sqrt[2] + ArcTan[1 + Sqrt[2]*x]/Sqrt[2] + Log[1 + x^4]/4

Rule 1876

Int[(Pq_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> With[{v = Sum[(x^ii*(Coeff[Pq, x, ii] + Coeff[Pq, x, n/2 + ii
]*x^(n/2)))/(a + b*x^n), {ii, 0, n/2 - 1}]}, Int[v, x] /; SumQ[v]] /; FreeQ[{a, b}, x] && PolyQ[Pq, x] && IGtQ
[n/2, 0] && Expon[Pq, x] < n

Rule 1162

Int[((d_) + (e_.)*(x_)^2)/((a_) + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[(2*d)/e, 2]}, Dist[e/(2*c), Int[1/S
imp[d/e + q*x + x^2, x], x], x] + Dist[e/(2*c), Int[1/Simp[d/e - q*x + x^2, x], x], x]] /; FreeQ[{a, c, d, e},
 x] && EqQ[c*d^2 - a*e^2, 0] && PosQ[d*e]

Rule 617

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = 1 - 4*Simplify[(a*c)/b^2]}, Dist[-2/b, Sub
st[Int[1/(q - x^2), x], x, 1 + (2*c*x)/b], x] /; RationalQ[q] && (EqQ[q^2, 1] ||  !RationalQ[b^2 - 4*a*c])] /;
 FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 1248

Int[(x_)*((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (c_.)*(x_)^4)^(p_.), x_Symbol] :> Dist[1/2, Subst[Int[(d + e*x)^q
*(a + c*x^2)^p, x], x, x^2], x] /; FreeQ[{a, c, d, e, p, q}, x]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rubi steps

\begin{align*} \int \frac{1+x+x^2+x^3}{1+x^4} \, dx &=\int \left (\frac{1+x^2}{1+x^4}+\frac{x \left (1+x^2\right )}{1+x^4}\right ) \, dx\\ &=\int \frac{1+x^2}{1+x^4} \, dx+\int \frac{x \left (1+x^2\right )}{1+x^4} \, dx\\ &=\frac{1}{2} \int \frac{1}{1-\sqrt{2} x+x^2} \, dx+\frac{1}{2} \int \frac{1}{1+\sqrt{2} x+x^2} \, dx+\frac{1}{2} \operatorname{Subst}\left (\int \frac{1+x}{1+x^2} \, dx,x,x^2\right )\\ &=\frac{1}{2} \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,x^2\right )+\frac{1}{2} \operatorname{Subst}\left (\int \frac{x}{1+x^2} \, dx,x,x^2\right )+\frac{\operatorname{Subst}\left (\int \frac{1}{-1-x^2} \, dx,x,1-\sqrt{2} x\right )}{\sqrt{2}}-\frac{\operatorname{Subst}\left (\int \frac{1}{-1-x^2} \, dx,x,1+\sqrt{2} x\right )}{\sqrt{2}}\\ &=\frac{1}{2} \tan ^{-1}\left (x^2\right )-\frac{\tan ^{-1}\left (1-\sqrt{2} x\right )}{\sqrt{2}}+\frac{\tan ^{-1}\left (1+\sqrt{2} x\right )}{\sqrt{2}}+\frac{1}{4} \log \left (1+x^4\right )\\ \end{align*}

Mathematica [A]  time = 0.0351092, size = 50, normalized size = 0.94 \[ \frac{1}{4} \left (\log \left (x^4+1\right )-2 \left (1+\sqrt{2}\right ) \tan ^{-1}\left (1-\sqrt{2} x\right )+2 \left (\sqrt{2}-1\right ) \tan ^{-1}\left (\sqrt{2} x+1\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(1 + x + x^2 + x^3)/(1 + x^4),x]

[Out]

(-2*(1 + Sqrt[2])*ArcTan[1 - Sqrt[2]*x] + 2*(-1 + Sqrt[2])*ArcTan[1 + Sqrt[2]*x] + Log[1 + x^4])/4

________________________________________________________________________________________

Maple [B]  time = 0.003, size = 102, normalized size = 1.9 \begin{align*}{\frac{\arctan \left ( -1+x\sqrt{2} \right ) \sqrt{2}}{2}}+{\frac{\sqrt{2}}{8}\ln \left ({\frac{1+{x}^{2}+x\sqrt{2}}{1+{x}^{2}-x\sqrt{2}}} \right ) }+{\frac{\arctan \left ( 1+x\sqrt{2} \right ) \sqrt{2}}{2}}+{\frac{\arctan \left ({x}^{2} \right ) }{2}}+{\frac{\sqrt{2}}{8}\ln \left ({\frac{1+{x}^{2}-x\sqrt{2}}{1+{x}^{2}+x\sqrt{2}}} \right ) }+{\frac{\ln \left ({x}^{4}+1 \right ) }{4}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^3+x^2+x+1)/(x^4+1),x)

[Out]

1/2*arctan(-1+x*2^(1/2))*2^(1/2)+1/8*2^(1/2)*ln((1+x^2+x*2^(1/2))/(1+x^2-x*2^(1/2)))+1/2*arctan(1+x*2^(1/2))*2
^(1/2)+1/2*arctan(x^2)+1/8*2^(1/2)*ln((1+x^2-x*2^(1/2))/(1+x^2+x*2^(1/2)))+1/4*ln(x^4+1)

________________________________________________________________________________________

Maxima [A]  time = 1.43715, size = 103, normalized size = 1.94 \begin{align*} -\frac{1}{4} \, \sqrt{2}{\left (\sqrt{2} - 2\right )} \arctan \left (\frac{1}{2} \, \sqrt{2}{\left (2 \, x + \sqrt{2}\right )}\right ) + \frac{1}{4} \, \sqrt{2}{\left (\sqrt{2} + 2\right )} \arctan \left (\frac{1}{2} \, \sqrt{2}{\left (2 \, x - \sqrt{2}\right )}\right ) + \frac{1}{4} \, \log \left (x^{2} + \sqrt{2} x + 1\right ) + \frac{1}{4} \, \log \left (x^{2} - \sqrt{2} x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^3+x^2+x+1)/(x^4+1),x, algorithm="maxima")

[Out]

-1/4*sqrt(2)*(sqrt(2) - 2)*arctan(1/2*sqrt(2)*(2*x + sqrt(2))) + 1/4*sqrt(2)*(sqrt(2) + 2)*arctan(1/2*sqrt(2)*
(2*x - sqrt(2))) + 1/4*log(x^2 + sqrt(2)*x + 1) + 1/4*log(x^2 - sqrt(2)*x + 1)

________________________________________________________________________________________

Fricas [B]  time = 1.56056, size = 440, normalized size = 8.3 \begin{align*} -\sqrt{-2 \, \sqrt{2} + 3} \arctan \left (\sqrt{x^{2} + \sqrt{2} x + 1}{\left (\sqrt{2} + 2\right )} \sqrt{-2 \, \sqrt{2} + 3} -{\left (\sqrt{2}{\left (x + 1\right )} + 2 \, x + 1\right )} \sqrt{-2 \, \sqrt{2} + 3}\right ) + \sqrt{2 \, \sqrt{2} + 3} \arctan \left (-{\left (\sqrt{2}{\left (x + 1\right )} - \sqrt{x^{2} - \sqrt{2} x + 1}{\left (\sqrt{2} - 2\right )} - 2 \, x - 1\right )} \sqrt{2 \, \sqrt{2} + 3}\right ) + \frac{1}{4} \, \log \left (x^{2} + \sqrt{2} x + 1\right ) + \frac{1}{4} \, \log \left (x^{2} - \sqrt{2} x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^3+x^2+x+1)/(x^4+1),x, algorithm="fricas")

[Out]

-sqrt(-2*sqrt(2) + 3)*arctan(sqrt(x^2 + sqrt(2)*x + 1)*(sqrt(2) + 2)*sqrt(-2*sqrt(2) + 3) - (sqrt(2)*(x + 1) +
 2*x + 1)*sqrt(-2*sqrt(2) + 3)) + sqrt(2*sqrt(2) + 3)*arctan(-(sqrt(2)*(x + 1) - sqrt(x^2 - sqrt(2)*x + 1)*(sq
rt(2) - 2) - 2*x - 1)*sqrt(2*sqrt(2) + 3)) + 1/4*log(x^2 + sqrt(2)*x + 1) + 1/4*log(x^2 - sqrt(2)*x + 1)

________________________________________________________________________________________

Sympy [A]  time = 0.324015, size = 73, normalized size = 1.38 \begin{align*} \frac{\log{\left (x^{2} - \sqrt{2} x + 1 \right )}}{4} + \frac{\log{\left (x^{2} + \sqrt{2} x + 1 \right )}}{4} + 2 \left (\frac{1}{4} + \frac{\sqrt{2}}{4}\right ) \operatorname{atan}{\left (\sqrt{2} x - 1 \right )} + 2 \left (- \frac{1}{4} + \frac{\sqrt{2}}{4}\right ) \operatorname{atan}{\left (\sqrt{2} x + 1 \right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**3+x**2+x+1)/(x**4+1),x)

[Out]

log(x**2 - sqrt(2)*x + 1)/4 + log(x**2 + sqrt(2)*x + 1)/4 + 2*(1/4 + sqrt(2)/4)*atan(sqrt(2)*x - 1) + 2*(-1/4
+ sqrt(2)/4)*atan(sqrt(2)*x + 1)

________________________________________________________________________________________

Giac [A]  time = 1.06195, size = 95, normalized size = 1.79 \begin{align*} \frac{1}{2} \,{\left (\sqrt{2} - 1\right )} \arctan \left (\frac{1}{2} \, \sqrt{2}{\left (2 \, x + \sqrt{2}\right )}\right ) + \frac{1}{2} \,{\left (\sqrt{2} + 1\right )} \arctan \left (\frac{1}{2} \, \sqrt{2}{\left (2 \, x - \sqrt{2}\right )}\right ) + \frac{1}{4} \, \log \left (x^{2} + \sqrt{2} x + 1\right ) + \frac{1}{4} \, \log \left (x^{2} - \sqrt{2} x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^3+x^2+x+1)/(x^4+1),x, algorithm="giac")

[Out]

1/2*(sqrt(2) - 1)*arctan(1/2*sqrt(2)*(2*x + sqrt(2))) + 1/2*(sqrt(2) + 1)*arctan(1/2*sqrt(2)*(2*x - sqrt(2)))
+ 1/4*log(x^2 + sqrt(2)*x + 1) + 1/4*log(x^2 - sqrt(2)*x + 1)